classdef MultiLabelMicroF1Measure ...
        < MultiLabelMetric
    %MULTILABELMICROF1MEASURE Summary of this class goes here
    %   Detailed explanation goes here
    
    properties
    end
    
    methods
        function [ this ] = MultiLabelMicroF1Measure( name )
            if nargin == 0
                this.setName('mlabel-micro-f1');
            end
            if nargin >= 1
                this.setName(name);
            end
        end
    end
    
    methods
        function [ result ] = apply( this, Y, Y_hat, Y_out )
            result = MultiLabelMicroF1Measure.calc(Y, Y_hat);
        end
    end
    
    methods ( Static = true )
        function [ result ] = calc(Y, Y_hat, Y_out )
%             Y(Y == -1) = 0;
%             Y_hat(Y_hat == -1) = 0;
            result = 2*nnz(Y ==1 & Y_hat == 1)/(nnz(Y == 1) + nnz(Y_hat == 1));
        end
    end
end

